package com.chinh.order.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.chinh.order.entity.Order;
import com.chinh.order.service.impl.OrderServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chinh
 * @date 2021/5/6
 */
@RestController
@RequestMapping("/order")
@RequiredArgsConstructor
public class OrderController {

    private final OrderServiceImpl orderService;

    @GetMapping("/{id}")
    public Order findById(@PathVariable Long id){
        return orderService.getOne( Wrappers.<Order>lambdaQuery().eq(Order::getId, id));
    }
}
